
# 删除排序数组,双指针法:但是我这个其实是相当于利用了一个额外变量pre来存储前一个不同的数值,其实没有必要.直接存在nums里面就可以
def removeDuplicates(self, nums: List[int]) -> int:
    if len(nums) == 0: return 0
    count = 0
    pre = nums[0]
    for i in range(1, len(nums)):
        if nums[i] != pre:
            count = count + 1
            nums[count] = nums[i]
            pre = nums[i]
    return count + 1

# 省一点内存
def removeDuplicates(self, nums: List[int]) -> int:
    if len(nums) == 0: return 0
    count = 0
    for i in range(1, len(nums)):
        if nums[i] != nums[count]:
            count = count + 1
            nums[count] = nums[i]
    return count + 1